{% extends "templates/atnet_base.html" %}

{% block csslink %}
{{ super() }}
<script src="/media/js/jquery.js"></script>

{% include 'templates/includes_datatable.html' %}
{% include 'templates/includes_jquery_ui.html' %}
<script src="/media/js/form_popup.js"></script>
	
<script type="text/javascript" charset="utf-8">
$(document).ready(function() {
	$('#invoices').dataTable({
		"bPaginate": false,
		"bLengthChange": false,
		"bFilter": true,
		"bSort": false,
		"bInfo": true,
		"bAutoWidth": true,
		"oLanguage": {
			"sUrl": "/media/js/dataTables.{{ app_user.lang }}.txt"
		},
		"bProcessing": true,
		"sAjaxSource": "{{ uri_for('vie_general_ledger', imm_id=immeuble.key().id(), command='list_json') }}",
	});
	
	$('#invoices tbody tr a').live('click', function(e) {
		if ($(this).attr('class') == 'delete') {
			$(this).LaunchPopup(
					{
						TableId: '#invoices',
						DivId: '#dialog-form',
						FormId: '#generated-form',
						UrlForm: "{{ uri_for('vie_general_ledger', imm_id=immeuble.key().id(), command='delete') }}" + e.target.id + "/",
						Mode: 'delete',
						Title: '{{ _("Delete record") }}',
					}
				)
		}
	});
});
</script>
{% endblock %}

{% block title %} 
	{{ title }}
{% endblock %}

{% block header %}
{{ header }}
{% endblock %}

{% block login%}
{% if show_login %}
{{ super() }}
{% endif %}
{% endblock%}

{% block navigation %}
{% if not show_login %}
{{ super() }}
{% endif %}
{% endblock %}

{% block page_name %}
{{ content_header }}
{% endblock %}

{% block section_menu %}
{% include 'templates/includes_vie_de_la_copropriete.html' %}
{% endblock %}

{% block main_content %}
<p>
	<div id="demo">
	<table cellpadding="0" cellspacing="0" border="0" class="display" id="invoices" width="100%">
		<thead>
			<tr>
				<th>{{ _(fields.input_date) }}</th> 
				<th>{{ _(fields.source) }}</th>
				<th>{{ _(fields.number) }}</th>
				<th>{{ _(fields.doc_date) }}</th>
				<th>{{ _(fields.ini_subaccount_code) }}</th>
				<th>{{ _(fields.ini_subaccount_name) }}</th>
				<th>{{ _(fields.description) }}</th>
				<th>{{ _(fields.debit) }}</th>
				<th>{{ _(fields.credit) }}</th>
				<th>{{ _(fields.contr_subaccount_code) }}</th>
				<th>{{ _(fields.contr_subaccount_name) }}</th>
				<th>{{ _(fields.period) }}</th>
				<th>{{ _(fields.entry_type) }}</th> 
				<th>{{ _(fields.reversal) }}</th>
			</tr>
		</thead>
		<tbody>
		</tbody>
		<tfoot>
			<tr>
				<th>{{ _(fields.input_date) }}</th> 
				<th>{{ _(fields.source) }}</th>
				<th>{{ _(fields.number) }}</th>
				<th>{{ _(fields.doc_date) }}</th>
				<th>{{ _(fields.ini_subaccount_code) }}</th>
				<th>{{ _(fields.ini_subaccount_name) }}</th>
				<th>{{ _(fields.description) }}</th>
				<th>{{ _(fields.debit) }}</th>
				<th>{{ _(fields.credit) }}</th>
				<th>{{ _(fields.contr_subaccount_code) }}</th>
				<th>{{ _(fields.contr_subaccount_name) }}</th>
				<th>{{ _(fields.period) }}</th>
				<th>{{ _(fields.entry_type) }}</th> 
				<th>{{ _(fields.reversal) }}</th>
			</tr>
		</tfoot>
	</table>
	</div>
	{% include 'templates/includes_popup_form.html' %}
</p>
<script>
$(document).ready(function() {
	var user_lang = "{{ app_user.lang }}";
	if (user_lang == "en") { user_lang = "en-GB"};
	$.datepicker.setDefaults( $.datepicker.regional[ user_lang ] );
	
	$("#deadline").live("focus", function() {
	    $(this).datepicker({
	        inline: true 
	    });
	});
});
</script>			

{% endblock %}
